/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;

/**
 * <p>Project: jse2204 - T6
 * <p>Powered by webrx On 2022-09-30 09:40:30
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class T6 {
    public static void main(String[] args) throws Exception{
        //Timer 定时器类
        //TimerTask 任务类
        //TimeUnit 时间颗粒工具类

        Timer t = new Timer();
        /*
        t.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.printf("%tF %<tT%n",System.currentTimeMillis());
                //t.cancel();
            }
        },3000,1000);*/
        System.out.printf("%tF %<tT%n", System.currentTimeMillis());

        long time = System.currentTimeMillis() + 1000 * 60;

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dd = sdf.parse("2022-09-30 10:00:00");
        t.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.printf("%tF %<tT%n", System.currentTimeMillis());
                //t.cancel();
            }
        }, dd);

        long ttt = TimeUnit.MINUTES.toMillis(5);
        System.out.println(ttt);
    }
}
